<?php
class BrandProAction extends LoginAction
{
    public function index ()
    {
        $BrandProModel = M('BrandPro');
        $BrandPro = $BrandProModel->select();
        if ($BrandPro) {
            $this->assign('brandPro', $BrandPro);
        }
        $this->display();
    }
    /**
     * 添加品牌属性操作
     * @author Ice iceinto@mallog.com.cn
     */
    public function add ()
    {
        if (isPost()) {
            $this->createAdd('BrandPro');
        }
        $this->display();
    }
    /**
     * 修改品牌属性操作
     * @author Ice iceinto@mallog.com.cn
     */
    public function edit ()
    {
        $brandPro = null;
        $id = (int) getGetOrPost('id');
        $BrandProModel = D('BrandPro');
        if ($id) {
            $map = array('id' => $id);
            $brandPro = $BrandProModel->where($map)->find();
        }
        if (isPost() && $brandPro) {
            $this->createUpdate('BrandPro');
            $brandPro = $BrandProModel->where($map)->find();
        }
        if ($brandPro) {
            $this->assign('brandPro', $brandPro);
            $this->display();
        } else {
            $this->error('对应品牌属性不存在！');
        }
    }
}
?>